{{extend 'layout.html'}}

<div id="toolbar" class="btn-toolbar">
    <a id="filter_hosts" class="btn btn-small" data-toggle="modal" href="#filterModal"><i class="icon-filter"></i> Filter</a>
</div>

<div class="tabheader" style="clear: both;">

    <div id="tabs">
        <ul id="tabs-ul" class="nav nav-tabs">
            <li class="active"><a href="#hash_stats" data-toggle="tab"><u>H</u>ashes</a></li>
            <li><a href="#top_passwords" data-toggle="tab"><u>T</u>op Passwords</a></li>
            <li><a href="#password_stats" data-toggle="tab"><u>P</u>assword Stats</a></li>
            <li><a href="#password_len" data-toggle="tab">Password <u>L</u>engths</a></li>
            <li><a href="#docbook_tables" data-toggle="tab"><u>D</u>ocbook/SPARX Tables</a></li>
        </ul>

    <div id="TabContent" class="tab-content">
        <div class="tab-pane active" id="hash_stats" >
            <table id="hashestable" class="datatable">
                <thead>
                    <th>Hash Type</th>
                    <th>Count</th>
                </thead>
                <tbody>
                    {{for p in hash_stats:}}
                    <tr>
                        <td>{{=p.t_accounts.f_hash1_type}}</td>
                        <td>{{=p._extra.values()[0]}}</td>
                    </tr>
                    {{pass}}
                </tbody>
            </table>
        </div>

        <div class="tab-pane" id="top_passwords">
            <table id="toptable" class="datatable">
                <thead>
                    <th>Password</th>
                    <th>Count</th>
                </thead>
                <tbody>
                    {{for p in top:}}
                    <tr>
                        <td>{{=p.t_accounts.f_password}}</td>
                        <td>{{=p._extra.values()[0]}}</td>
                    </tr>
                    {{pass}}
                </tbody>
            </table>
        </div>

        <div class="tab-pane" id="password_stats">
            <table id="passwordtable" class="datatable">
                <thead>
                    <th>Password</th>
                    <th>Count</th>
                </thead>
                <tbody>
                    {{for p in pwstats:}}
                    <tr>
                        <td>{{=p}}</td>
                        <td>{{=pwstats[p]}}</td>
                    </tr>
                    {{pass}}
                </tbody>
            </table>
        </div>

        <div class="tab-pane" id="password_len">
            <table id="pwlentable" class="datatable">
                <thead>
                    <th>Password Length</th>
                    <th>Count</th>
                </thead>
                <tbody>
                    {{for p in pwlenstats:}}
                    <tr>
                        <td>{{=p}}</td>
                        <td>{{=pwlenstats[p]}}</td>
                    </tr>
                    {{pass}}
                </tbody>
            </table>
        </div>

        <div class="tab-pane" id="docbook_tables">
            <h3>Top Passwords</h3>
            {{=BEAUTIFY(top_sparx_table)}}
            <br/>
            <h3>Password Statistics</h3>
            {{=BEAUTIFY(pwstats_sparx_table)}}
        </div>

    </div>
</div>

<script>
var $refreshpage = true;

$(document).ready(function() {

    // Mousetrap bindings
    Mousetrap.bind(['h','H','1'], function() { jQuery('#tabs-ul a[href="#hash_stats"]').tab('show'); });
    Mousetrap.bind(['t','T','2'], function() { jQuery('#tabs-ul a[href="#top_passwords"]').tab('show'); });
    Mousetrap.bind(['p','P','3'], function() { jQuery('#tabs-ul a[href="#password_stats"]').tab('show'); });
    Mousetrap.bind(['l','L','4'], function() { jQuery('#tabs-ul a[href="#password_len"]').tab('show'); });
    Mousetrap.bind(['d','D','5'], function() { jQuery('#tabs-ul a[href="#docbook_tables"]').tab('show'); });

    var hashestable;
    hashestable = $('#hashestable').dataTable( {
          "aaSorting": [ [1, "desc"] ],
          "sDom": 'T<"clear">lfrtip',
          "oTableTools": {
              "sSwfPath": "{{=URL(request.application,'static','TableTools/swf/copy_csv_xls.swf')}}"
          },
    } );

    var toptable;
    toptable = $('#toptable').dataTable( {
          "aaSorting": [ [1, "desc"] ],
          "sDom": 'T<"clear">lfrtip',
          "oTableTools": {
              "sSwfPath": "{{=URL(request.application,'static','TableTools/swf/copy_csv_xls.swf')}}"
          },
    } );

    var passwordtable;
    passwordtable = $('#passwordtable').dataTable( {
          "aaSorting": [ [1, "desc"] ],
          "sDom": 'T<"clear">lfrtip',
          "oTableTools": {
              "sSwfPath": "{{=URL(request.application,'static','TableTools/swf/copy_csv_xls.swf')}}"
          },
    } );

    var pwlentable;
    pwlentable = $('#pwlentable').dataTable( {
          "aaSorting": [ [1, "desc"] ],
          "sDom": 'T<"clear">lfrtip',
          "oTableTools": {
              "sSwfPath": "{{=URL(request.application,'static','TableTools/swf/copy_csv_xls.swf')}}"
          },
    } );

});
</script>

{{include 'filter_hosts.html'}}
